import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JMenuItem;


public class ClickListener implements ActionListener{
	Othello game;

	public ClickListener(Othello g){
		game = g;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() instanceof JMenuItem){
			if((((JMenuItem)e.getSource()).equals(game.load)))
				game.loadButtons();
			if((((JMenuItem)e.getSource()).equals(game.save)))
				game.save();
			if((((JMenuItem)e.getSource()).equals(game.reset)))
				game.reset();
			if((((JMenuItem)e.getSource()).equals(game.exit)))
				System.exit(0);
		}
		else
			game.buttonClick((JButton)e.getSource());
	}

}
